import React from 'react'
// ===================================================================== Temp
import SearchForm from '#cpt/temp/SearchForm'
import Table from '#cpt/temp/Table'
import Controls from '#cpt/temp/Controls'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const Page 					= $Lazy.load(()=>import('#tp/page/page-container'))

// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		// 搜索表单列表
		forms : [
			{ label: '接收时间',		names: ['start_at','end_at'], 	type:'date-range' },
		],
	}
	
	model = {}
	
	componentDidMount(){
		if(window.isInit){
			this.fetch()
		}
	}

	// paging
	fetch = () => $fn.fetch.call(this,'statistics/labTATFTCount',{isIndex:true})
	
	// 表单
	cols = [
		{ title: '检测项目名称', 	dataIndex: 'single_kind_name', 		width:200 },
		{ title: '检测数量', 		dataIndex: 'count_total', 			width:100 },
		{ title: '50中位数', 		dataIndex: 'median_minute_50', 		width:100 },
		{ title: '90中位数', 		dataIndex: 'median_minute_90', 		width:100 },
		{ title: '最短报告时间', 	dataIndex: 'min_minute', 			width:100 },
		{ title: '最长报告时间', 	dataIndex: 'max_minute', 			width:100 },
	]
	// 操作按钮
	controls = () => {
		return [
			Controls.exports.call(this, 'statistics/labTATFTCount'),			// 导出
		]
	}
	
	render(){
		return (
			<>
				<Page title='固定时间TAT统计' controls={this.controls()}>
					{/* 搜索 */}
					{ SearchForm.call(this) }
					{/* 表格 */}
					{ Table.call(this,{isIndex:true,isInit:window.isInit}) }
				</Page>
			</>
		)
	}
}

export default Index